package config

type AllConfigStruct struct {
	Mysql struct {
		Path     string `mapstructure:"path"`
		Port     string `mapstructure:"port"`
		Config   string `mapstructure:"config"`
		DbName   string `mapstructure:"db-name"`
		Username string `mapstructure:"username"`
		Password string `mapstructure:"password"`
	} `mapstructure:"mysql"`

	Cors struct {
		Mode      string      `mapstructure:"mode"`
		Whitelist []Whitelist `mapstructure:"whitelist"`
	} `mapstructure:"cors"`

	JWT struct {
		SigningKey  string `mapstructure:"signing-key"`  // jwt签名
		ExpiresTime int64  `mapstructure:"expires-time"` // 过期时间
		BufferTime  int64  `mapstructure:"buffer-time"`  // 缓冲时间
		Issuer      string `mapstructure:"issuer"`       // 签发者
	} `mapstructure:"jwt"`

	Redis struct {
		DB       int    `mapstructure:"db"`
		Addr     string `mapstructure:"addr"`
		Password string `mapstructure:"password"`
	} `mapstructure:"redis"`

	Consul struct {
		ConsulAddr string   `mapstructure:"consul-addr"`
		Name       string   `mapstructure:"name"`
		Tags       []string `mapstructure:"tags"`
	} `mapstructure:"consul"`

	Zap struct {
		Level      int    `mapstructure:"level"`
		Filename   string `mapstructure:"filename"`
		MaxSize    int    `mapstructure:"max-size"`
		MaxBackups int    `mapstructure:"max-backups"`
		MaxAge     int    `mapstructure:"max-age"`
		Compress   bool   `mapstructure:"compress"`
	} `mapstructure:"zap"`
}

type Whitelist struct {
	AllowOrigin      string `mapstructure:"allow-origin"`
	AllowMethods     string `mapstructure:"allow-methods"`
	AllowHeaders     string `mapstructure:"allow-headers"`
	ExposeHeaders    string `mapstructure:"expose-headers"`
	AllowCredentials bool   `mapstructure:"allow-credentials"`
}
